define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init();
            this.table.first();
            this.table.second();
            this.table.third();
        },
        table: {
            first: function () {
                // 表格1
                var table1 = $("#table1");
                table1.bootstrapTable({
                    url: 'agent/agentmanage/table1',
                    toolbar: '#toolbar1',
                    sortName: 'admin_id',
                    // search: false,
                    searchFormVisible: true,
                    searchFormTemplate: 'customformtpl',
                    columns: [
                        [
                            {field: 'itemsName', title: '类目名'},
                             {field: 'itemsValue', title: '类目值'},

                        ]
                    ]
                });

                // 为表格1绑定事件
                Table.api.bindevent(table1);
            },

            second: function () {
                // 表格2
                var table2 = $("#table2");
                table2.bootstrapTable({
                    url: 'agent/agentmanage/table2',
                    toolbar: '#toolbar2',
                    sortName: 'admin_id',
                    search: false,
                    columns: [
                        [
                            {field: 'itemsName', title: '类目名'},
                            {field: 'itemsValue', title: '类目值'},
                        ]
                    ]
                });

                // 为表格2绑定事件
                Table.api.bindevent(table2);
            },
            third: function () {
                // 表格3
                var table3 = $("#table3");
                table3.bootstrapTable({
                    url: 'agent/agentmanage/table3',
                    toolbar: '#toolbar3',
                    sortName: 'admin_id',
                    search: false,
                    columns: [
                        [
                            {field: 'itemsName', title: '类目名'},
                            {field: 'itemsValue', title: '类目值'},
                        ]
                    ]
                });

                // 为表格2绑定事件
                Table.api.bindevent(table3);
            },
        },
    };
    return Controller;
});
